<?php
$invoice = $params['invoice'];
?>
<style type="text/css">
.box-block {
	padding: 29px 29px 19px 29px;
	margin: 0 auto 20px;
	background-color: #FFF;
	border: 1px solid #E5E5E5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
}
</style>
<div class="box-block confirmBuyPackageBlock">
	<h3>Invoice id <?php echo $invoice['id'];?></h3>
	<hr />
	<div class="controls">
		<div class="span6">
			<p>วันที่: <?php $dateTime = new DateTime($invoice['createTime']); echo $dateTime->format('j/m/Y');?></p>
			<p>กำหนดชำระ: <?php $dateTime = new DateTime($invoice['dateDue']); echo $dateTime->format('j/m/Y');?></p>
			<p>สถานะ: <?php
			switch($params['invoice']['status']){
                case Invoice::STATUS_PAY: echo 'ชำระแล้ว'; break;
				case Invoice::STATUS_CHECK: echo 'รอตรวจสอบ'; break;
				default: echo 'ยังไม่ได้ชำระ'; break;
			}
			?></p>
		</div>
		<div class="span4">
			<h4>ออกให้</h4>
			<p>
			<?php
            if($invoice['profileType']=='account'){
                if(!empty($invoice['account']['name']))
                    echo '<p>'.$invoice['account']['name'].'</p>';

                if(!empty($invoice['account']['email']))
                    echo '<p>'.$invoice['account']['email'].'</p>';

                if(!empty($invoice['account']['address']))
                    echo '<p>'.$invoice['account']['address'].'</p>';
            }
            else {
                if(!empty($invoice['profile']['name']))
                    echo '<p>'.$invoice['profile']['name'].'</p>';

                if(!empty($invoice['profile']['address']))
                    echo '<p>'.$invoice['profile']['address'].'</p>';
            }
			?>
			</p>
		</div>
		<div class="clear"></div>
	</div>
	<hr />
	<table class="table">
		<thead>
			<tr>
				<th>รายการ</th>
				<th>Info</th>
				<th>ระยะเวลา</th>
				<th>ค่าใช้จ่าย</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>
                    <strong><?php echo $invoice['package']['type'];?></strong><br />
                    <span><?php echo $invoice['package']['name'];?></span>
                </td>
				<td><?php echo nl2br($invoice['info']);?></td>
				<td><?php echo $invoice['month'];?></td>
				<td><?php echo $invoice['price'];?></td>
			</tr>
			<tr class="success">
				<td></td>
				<td></td>
				<td><strong>รวม</strong></td>
				<td><?php echo $invoice['price'];?></td>
			</tr>
		</tbody>
	</table>
</div>
<div class="text-right">
	<a href="index.php?page=recommend.payment">วิธีการจ่ายเงิน</a><br />
	<a href="index.php?page=payment&invoiceId=<?php echo $_GET['id'];?>">แจ้งจ่ายเงินสำหรับ invoice นี้</a><br />
	<a class="btn printButton">print</a>
</div>
<style type="text/css" media="print">
#page {
	display: none;
}

Size : 8.27in and 11.69 inches

@page printArea {
	size:8.27in 11.69in; 
	margin:.5in .5in .5in .5in; 
	mso-header-margin:.5in; 
	mso-footer-margin:.5in; 
	mso-paper-source:0;
}

div#printArea {
	printArea;
}

#printArea {
	display: block;
	border: 1px solid black;
}
</style>
<script type="text/javascript">
$(function(){
	var printArea = $('<div id="printArea"></div>');
	printArea.html($('.printHtml').html());
	$('body').append(printArea);
	$('.printButton').click(function(event){
		event.preventDefault();
		window.print();
	});
});
</script>